Post processing optimization of byte-code

نویسنده

  • Prabhas Chongstitvatana
چکیده

This work describes an optimization technique which is applied to post-process byte-code instructions. By extending a virtual machine of an instruction set, some sequence of byte-codes can be represented by a shorter code which can be executed faster. The experimental result showed that this technique yielded 25% 120% speedup on Stanford integer benchmark suite. 1. Motivation This work describes an optimization technique which is applied to post-process byte-code instructions. By extending a virtual machine of an instruction set, some sequence of byte-codes can be represented by a shorter code which can be executed faster. It is significant that this is a post-processing method, it is aimed to be applied to the already compiled program. There is no access to the source program. There are various uses of this technique, for example, to speed up the execution of JAVA applet [8,9] (which is bytecoded) that has been loaded into a browser, one has no access to the source program in such case. Motivation of this work came from an observation that a virtual machine for byte-code instructions aimed for portability and architectural neutral mostly concerns orthogonality of the instruction set. Therefore it is possible to specialise some sequence of codes to gain speed. Optimized compilation of conventional languages to stack-based virtual machine has received relatively little attention. Previous work has focused on using the stack efficiently for expression evaluation [1,2] and performing peephole optimizations [3,4]. Koopman [6] has done a work on optimizing stack usage at the basic block level and the global level. He performed intra-block stack scheduling which reported 91% 100% elimination of redundant local variable accesses. This work differs significantly from previous work in the premise that the technique reported is applied to byte-code, not at the source code level. In this regard, this work can be described as a bottom-up approach for code optimization as opposed to top-down approach in the optimization is applied to source code compilation. 2. Methodology Main idea for our bottom-up approach is to reconstruct basic blocks from the bytecodes which are compiled from benchmark programs (static analysis). We perform the analysis of the execution of these byte-codes and recognise the most frequently used sequences (grouping as basic blocks). From this dynamic analysis, the virtual machine is extended with specialised byte-codes to perform the most frequently used sequences. We select R1 concurrent system [7] as our base system for experimentation. R1 system composed of a compiler which compile R1 source language into byte-codes which will be executed by R1 run-time interpreter. The reason for choosing this system is simply that it is our own work therefore we have access to all details for its implementation. (A brief description of R1 system is given in the next section). We compiled seven integer benchmark programs from the Stanford Benchmark Suite [5]. These programs are : bubble sort, tower of Hanoi, matrix multiplication, permutation, quick sort, 8 queens problem and generate prime numbers by sieve method. Although significantly larger programs must be used to make conclusive statements about performance, these programs are sufficiently complex and varied at the basic block level to illustrate the effectiveness of our method. 3. R1 system R1 is a simple language which provides concurrency control, protection of shared resources, interprocess communication and real-time facilities. The aim of this language is for it to be a small, simple, and practical language for programming an embedded application. The syntax of R1 is intentionally made to be "like" C language. So that the user who is familiar with C language can read and write R1 easily. statements examples assignment a = b + 1 ; if-statement if ( expr ) stmt-true [ else stmt-false ] ; while-statement while ( expr ) stmt ; return-statement return ( expr ) ; function-call function-name ( actual parameters ) ; process-call process-name ( actual parameters ) ; Figure 1 Syntax of R1 language A program is composed of declarations and a main. There are four types of declaration : global variable declaration, semaphore declaration, function declaration, and process declaration. There are several types of statements : assignment statement, flow-control if and while, and some additional function for concurrent processing. Operators are basic operators such as + * / etc. including addressing operators '*' (dereference) and '&' (address). The scalar data is basically a word (which can be 16 bits or 32 bits depended on the architecture of the target hardware) with no type. Only one type of structured data is available, it is a one dimensional array of words. Global variables must be declared. Local variables are automatically declared and they are lexical-scoped. Local variables appear in the formal parameter list and can not be an array variable.

برای دانلود رایگان متن کامل این مقاله و بیش از 32 میلیون مقاله دیگر ابتدا ثبت نام کنید

ثبت نام

اگر عضو سایت هستید لطفا وارد حساب کاربری خود شوید

منابع مشابه

Byte Code Engineering

The term “Java” is used to denote two different concepts: the language itself and the related execution environment, the Java Virtual Machine (JVM), which executes byte code instructions. Several research projects deal with byte code-generating compilers or the implementation of new features via byte code transformations. Examples are code optimization, the implementation of parameterized types...

متن کامل

Machine Learning-Assisted Binary Code Analysis

Binary code analysis is a foundational technique in the areas of computer security, performance modeling, and program instrumentation. In computer security, such analysis can provide the basis for detecting, understanding and controlling malicious code. Any analysis of malicious program requires as a first step precisely locating the Function Entry Points (FEPs, the starting byte of each functi...

متن کامل

Bi-Endian Compiler: A Robust and High Performance Approach for Migrating Byte Order Sensitive Applications

In this paper, we describe the implementation and performance evaluation of a bi-endian capable compiler. Software migration of legacy applications from one endian architecture to another is oftentimes hampered by byte order dependencies hidden in the source code. These dependencies can be expensive to find and address in a systematic fashion. We introduce the Bi-endian Compiler (BEC) capable o...

متن کامل

Multilingual Text Processing in a Two-Byte Code

ABS~ACT National and international standards committees are now discussing a two-byte code for multilingual information processing. This provides for 65,536 separate character and control codes, enough to make permanent code assiguments for all the charanters of ell national alphabets of the world, and also to include Chinese/Japanese characters. This paper discusses the kinds of flexibility re...

متن کامل

TinyVM: an energy-efficient execution infrastructure for sensor networks

Energy-efficient implementation techniques for virtual machines (VMs) have received little attention yet: conventional wisdom claims that VMs have a diametrical effect on energy consumption and sensor network applications on VMs are therefore short-lived. In this paper we argue that bytecode interpretation is affordable for sensor networks if we synthesize VMs specifically for energy-efficiency...

متن کامل

ذخیره در منابع من


  با ذخیره ی این منبع در منابع من، دسترسی به آن را برای استفاده های بعدی آسان تر کنید

عنوان ژورنال:

دوره   شماره 

صفحات  -

تاریخ انتشار 1997